Most Java developers are
familiar with the power of Ant
for writing build scripts, deployment scripts and sundry other tasks.
Antigen wraps up an Ant script as an executable jar file and combines
it with a user-friendly GUI.
The most obvious application is to use Antigen to create Installers. You write an Ant script to install your application, using the <input> task to prompt the user for configuration settings such as installation location, write a small properties file setting up window titles, icons etc and then run Antigen to wrap the whole lot up as an executable jar file. When you're finished, you have a GUI based installer such as the one on the right. The end-user does not need Ant on their machine to use it, just Java. |
Antigen can be used to wrap your Ant script in two ways. The quickest
way to get started is to use the Antigen tool (see QuickStart).
Alternatively, you can include the Antigen jar file (known as Antibody) in your build process -
this is particularly easy to do if you're using Maven to build your application.
Quick Start
If you have your Ant build.xml ready, this will take a few seconds.
Trying to keep pace with the number of options is
probably futile, so here is a link to the latest config.properties
file in cvs, which
should be documented well enough to work things out.
The main things to note are:
Location of logos and other resources
Logos and other resources should be placed under
the folder containing the config.properties file. Thus, to set the top
right logo and the intro text
you place entries in the config.properties file of
antigen.logo.right=img/logo.jpg
antigen.intro.template=velocitytemplates/hello.html
and have a directory structure
. `-- resources |-- img | | | `-- logo.jpg |-- velocitytemplates | | | `-- hello.html `-- config.properties
Intro and Outtro pages and Velocity Templates
You can specify text to be shown to the user
before and after the installation process. This is quite handy for
warning him or her what is about to happen! You can either specify the
text in the property file, or provide a reference to a text file (see Location of logos and other resources). In both
cases the text supplied should be html formatted. In the latter case,
the text is always processed by Velocity (and therefore
the velocity library must not be excluded from the installer if this
feature is used!). This is very powerful, and allows you to interpolate
ant properties in your text, and show text conditionally based in
property settings. Note, that velocity does not allow properties to
include a period as part of their name, so these are replaced with
underscores in the velocity engine. Thus if your ant file includes a
task
<input addproperty="your.name">Enter your name</input>
then in your outtro text you can do things like:
Goodbye $your_name!
Prompting the user for input
Any <input/> tags in your buildfile will cause a dialog box to be opened to prompt the user for input. The exact form of this dialog depends on a number of things. If the validargs attribute has been set to restrict the user input, then the dialog will have radio buttons for the user to select. If you wish the user to enter a file name or dir name, then it is possible to configure antigen to recognise certain property suffices such as .file or .dir as representing files and directories, and the dialog box will include a browse button to allow the user to select the file from their file system. In all cases the dialog boxes are prepopulated with the contents of the defaultvalue attribute, if present. As is standard practice in Ant 1.6+, if a property is already set, then the input task will be skipped.
Antigen has a number of options that can be specified on the commandline. To view them type
java -jar myinstaller.jar -hThese options include increasing the debug logging output for when your installer isn't working as it ought to, and running the installer in a text-only environment.
Coming soon....in the meantime, you should be able to work out how to do it from looking at the build of Antigen itself....Antigen was built with Antigen. You can install the entire source tree on your machine by downloading and running the Source Code Installer. Like everything else, this was created from an Ant script wrapped by Antigen.
By default the installer will include
If you feel strongly that other tasks should be included by default please get in touch.
If you wish to include more jars in your installer then you have two options: